﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace TV4Home.MvcWebInterface.UI.Controllers
{
    public class PictureLibraryController : Controller
    {
        public ActionResult Index()  
        {
            return View(WebService.GmaWebService.ServiceInstance.MP_GetPictureDirectory(@"C:\Users\Public\Pictures"));
        }
        public ActionResult Browse(string path)
        {
            return View(WebService.GmaWebService.ServiceInstance.MP_GetPictureDirectory(new System.Text.ASCIIEncoding().GetString(Server.UrlTokenDecode(path))));
        }
        public ActionResult Image(string path)
        {
            byte[] image = System.IO.File.ReadAllBytes(new System.Text.ASCIIEncoding().GetString(Server.UrlTokenDecode(path)));
            return File(image, "image/jpg");
        }

    }
}
